4D Chart v13Creating Graphs from Arrays (examples) |
||
|
4D Chart v13
Creating Graphs from Arrays (examples)
Creating Graphs from Arrays (examples)
This section provides examples that use the CT Chart arrays function to create two- and three-dimensional graphs. If you want to create graphs programmatically from records in a database, refer to the section Creating Graphs from Records in a Database (examples). In each example, you will find:
Suppose that you are a new manager in the Engineering division of a company that manufactures widgets. One of your new responsibilities is to decrease the amount of time your departments take to respond to customers’ requests for help. You decide to design a database to track the response time of each department. The structure of your database is as follows: To analyze the information you have gathered, you decide to graph the average response time ((Completion Date - Request Date)/ # of requests) for each department for each month of the past year. Using 4D Chart, you produce the following graph: This graph was generated and formatted using the GR RESPONSE method. This method fills arrays with data, generates a graph from the arrays, and then customizes certain aspects of the graph, such as the axis titles and series colors. The first part of the method uses 4D commands and functions to create and fill the arrays. The contents of the Categories array are hardcoded, the contents of the Series array are taken directly from the database, and the contents of the Values array are the results of data manipulation. The size of the Values array is equal to the size of the Categories array multiplied by the size of the Series array. This method uses sets to manipulate the selection of records. After you have created a set, you can change the selection of records as needed by searching and then return to the original set of records again and again. In this method, a set is used to maintain the selection of records for the entire graph. The selection is altered during the filling of the Values array, because the values are determined by the selection that results from searching for the records for each department for each month. After the arrays are filled, 4D Chart commands are used to create the graph and modify its features. The following is the GR RESPONSE method: `Method: GRAPH RESPONSE Suppose you are Western Regional Director of an educational program, and you would like to determine whether the test scores of students in your region have been improving. Your database contains the scores for students in your region, tagged by test date and home state. Note: This is the same data used in the example Creating a Two-Dimensional Graph with the Series Defined by Data in Records in the section Creating Graphs from Records in a Database (examples). Because there were multiple test dates in each year, you cannot graph the data directly from the database. Instead, you create a method that places the data in arrays, enabling you to use each year as a category and the individual states as the series. This graph was generated using the GRAPH SCORES 3D method. This method fills the arrays with data, generates a graph from the arrays, and then customizes certain aspects of the graph. The contents of the Categories array are hardcoded. The contents of the Series array are taken from the database. The contents of the Values array are the averages of each state’s test scores for each year. The size of the Values array is equal to the size of the Categories array multiplied by the size of the Series array. Using 4D Chart commands, the 4D Chart menu bar, scroll bars, rulers, and tool palettes are hidden. The 4D Chart area is set to Non-enterable, meaning that the user cannot select any object in the area or make any changes to it. The following is the GRAPH SCORES 3D method: `Method: GRAPH SCORES 3D |
PROPERTIES
Product: 4D Chart SEE ALSO
Creating Graphs from Records in a Database (examples) |